
package it.txt.access.capability.demo.soap.server.ws;


import it.txt.access.capability.demo.schema.CapabilityRequestType;
import it.txt.access.capability.demo.schema.CapabilityResponseType;
import it.txt.access.capability.demo.soap.server.service.CapabilityServiceException;
import it.txt.access.capability.demo.soap.server.service.CapabilityService;
import java.util.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
import org.springframework.ws.server.endpoint.annotation.ResponsePayload;
import static it.txt.access.capability.demo.soap.server.ws.CapabilityWSConstants.*;


@Endpoint
public class CapabilityEndpoint{

    private static final Logger LOGGER = Logger.getLogger(CapabilityEndpoint.class.getName());
    private final CapabilityService capabilityService;

    @Autowired
    public CapabilityEndpoint(CapabilityService capabilityService) {
        this.capabilityService = capabilityService;
    }
    
    @PayloadRoot(localPart = CAPABILITY_REQUEST_LOCAL_NAME, namespace = CAPABILITY_DEMO_NAMESPACE_URI)
    @ResponsePayload
    public CapabilityResponseType handleSaajCapabilityRequest(
            @RequestPayload CapabilityRequestType crt) throws CapabilityServiceException{
        return capabilityService.capabilityAccessRequest(crt);
    }
}
